Command Line Usage

Deploying DTF to several machines and setting it up to run can be done manually and isn't that hard all you have to do is copy the build/dtf/dist directory to the machine you want to start any of the DTF components and then you can issue the appropriate command line to start that component up. You will need a Sun JDK 1.5+ to execute the components and then you can start them up with the following example command lines:

Start up the DTFC (Controller):

./ant.sh run_dtfc
Start up a DTFA and connect it to the controller on the specified address:
./ant.sh run_dtfa -Ddtf.connect.addr=host_machine_for_dtfc
Start up the test tests/xxx.xml and run it against the controller on the specified address:
./ant.sh run_dtfx -Ddtf.connect.addr=host_machine_for_dtfc -Ddtf.xml.filename=tests/ut/echo.xml

That is the manual way and is easy enough for small setups with just 2-3 agents but when we get into larger setups that run multiple client side agents and a few other server side agents and we have to use SSH tunneling in order to connect some of those agents back to the controller machine we find that the setup time is long and prone to errors. In order to make this easier, there is a way of starting up your DTF setup by just passing a configuration file to a few targets in your build and requesting to check the status, stop and start your setup, etc. This takes care of all of the configuration steps for you. Lets start by showing what the format of the actual configuration file looks like:

<setup xmlns="http://dtf.org/v1">
   
<dtfc host="${host}" user="${user}">
      
<dtfa host="${host}" user="${user}">
         
<property name="node.id" value="1" />
      
</dtfa>
      
<dtfa host="${host}" user="${user}">
         
<property name="node.id" value="2" />
      
</dtfa>
      
<dtfa host="${host}" user="${user}">
         
<property name="node.id" value="3" />
      
</dtfa>
      
<dtfx host="${host}" logs="tests/ut/output/ut_results.xml" test="tests/ut/ut.xml" user="${user}">
          
</dtfx>
   
</dtfc>
</setup>

Many of you will notice that it has a declaration just like the normal DTF test scripts but just a few new tags that are used to define your setup. The tags themselves just define the important properties that are necessary for the deployment feature to know where to setup each component. So you can see that you need to specify at least the host and user name to be used to SSH into each machine, that will also be the user that the component would be executed as. Then you can specify any properties directly in this file that would be loaded into the component at runtime.

All of the deployment targets are available under the build directory (dtf/build/dtf/dist) and all you need to do to see the available targets is issue the command ./ant.sh -p to see each target and a description of what it does. Now we'll go through the most used targets and how they can be used to setup and monitor your DTF configuration.

Setup Configuration

./ant.sh setup-dtf -Ddeploy.config=path/to/your/config.xml

This will setup all of the machines identified in the deploy.config file (default is config.xml) so that the DTFC and the machine issuing this command can SSH into any of those other machines. This allows the DTFC to be able to startup the necessary components on the other machines and allows the issuing machine to be able to gather logs. The SSH keys generated and used from now on will be under you $HOME/.dtf directory on *nix machines and under %HOMEPATH%/dtf directory for Windows. When executing this command be sure to watch for prompts like so:

  setup-dtf: 
      [java] INFO  10/11/2009 11:06:24 DeployUI        - rlgomes@dayspentlist.corp.yahoo.com:
 

This is basically a prompt from SSH requesting you type your password and currently the password will be visible to the person typing. So be careful not to do this step when others are watching your screen.

Start Configuration

./ant.sh deploy-start -Ddeploy.config=path/to/your/config.xml

The previous target starts up your DTFC first and then make sure that its up and running, then it will start up each of the DTFA specified and lastly start up a DTFX if one is defined. Once this has completed you should be able to check the status of your with the follow target.

Check Status of Configuration

./ant.sh deploy-status -Ddeploy.config=path/to/your/config.xml

This will output the current state of your configuration when compared with the configuration file you've specified. It will identify DTFA's that are no longer running as well as the state of your runner's (DTFX) last test run. Here's an example of running this command with the tests/setup/ut_config.xml configuration file on your localhost:

./ant.sh -Ddeploy.config=tests/setup/ut_config.xml -Dhost=localhost -Duser=rlgomes deploy-status
  
 Buildfile: build.xml
  
 init: 
     [echo] Creating log dir ./logs/10-11-2009.14.19.05
     [mkdir] Created dir: /home/rlgomes/workspace/dtf/build/dtf/dist/logs/10-11-2009.14.19.05
      
 deploy-init:
 
 deploy-status: 
     [java] INFO  10/11/2009 14:19:09 DeployDTF       - Status of dtfc on localhost
     [java] INFO  10/11/2009 14:19:09 DeployDTF       - DTFC on localhost
     [java] INFO  10/11/2009 14:19:09 DeployDTF       - DTFA [dtfa-0] on localhost is locked
     [java] INFO  10/11/2009 14:19:09 DeployDTF       - DTFA [dtfa-1] on localhost is locked
     [java] INFO  10/11/2009 14:19:09 DeployDTF       - DTFA [dtfa-2] on localhost is locked
     [java] INFO  10/11/2009 14:19:10 DeployDTF       - DTFX on localhost running tests/ut/state_management.xml:41,16
      
 BUILD SUCCESSFUL 
     Total time: 6 seconds 
 

You can easily see the state of each of the components connected and that your DTFX is currently on the test tests/ut/state_management.xml at line 41. You can also watch the output easily with the target deploy-watch. The deploy-watch target will tail the output file on the DTFX and you can watch it on your screen and Ctrl-C that whenever you'd like. Once the status reports that the DTFX is completed you can easily gather your logs.

Saving your Logs

./ant.sh -Ddeploy.config=tests/setup/config.xml deploy-savelogs

This target simply copies back all of the component output files to the dtf_logs directory and will copy any other of the log files from the runner that were specified with the attribute logs (comma separated list). Your old dtf_logs will be backed up to the dtf_logs_bk in case you required them for some reason.

Waiting for a deployment to finish running tests

You can easily wait on an existing setup that has a DTFX running in it by using the "deploy-wait" target to wait till the DTFX has completed and reports the exact status of that completion.

Other Targets

There are quite a few other deployment targets and you can easily check on the available targets by issuing an "ant -p", like so:

 > ant -p
 Buildfile: build.xml
 
 Main targets:
  deploy-savelogs  collect all of the logs for the DTF setup identifed by the ${deploy.config} property
  deploy-start     start the DTF setup defined in the ${deploy.config} file
  deploy-status    check the status of the DTF setup identified in the config file
  deploy-stop      This target will stop the specified DTF config and collect all of the logs
  deploy-wait      wait for the DTF setup defined in the ${deploy.config} file to complete running the test
  deploy-watch     sets up all machines identified in the ${deploy.config} file so they can be used by the other deploy-xxx targets
  run_dtfa         startup the DTFA component
  run_dtfc         startup the DTFC component
  run_dtfx         startup the DTFX component
  run_dvt          run DTF deployment verification tests (dvt).
  run_ut           run DTF unit tests.
  setup-script     execute a script on all machines identified in the ${deploy.config} file
  setup-ssh        sets up all machines identified in the ${deploy.config} file so that the deploy-xxx tags can SSH to those machines without any issues
 

Host Requirements

The host machines that you are going to deploy to require an ssh server running on them and they should have Java 1.5+ installed. Other than that there is a requirement at the OS level, that the following commands are available:

Command Usage
nohup command used to background the running of the components
cd command used to changed directories on the remote host machines.
cat command used copy files back and forth, the reason we use this instead of a built in ftp command of scp is because some older ssh versions don't support the file copying mechanism and by using this command we work around that problem.
chmod command used to set the correct execution attributes for the necessary executable files.
mkdir used to create directories remotely and locally for different operations.